home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacMETH 3.2.1 / MacMETH Manual 1992 / Manual Examples / CursorExample.MOD < prev    next >
Encoding:
Text File  |  1992-10-09  |  1.1 KB  |  38 lines  |  [TEXT/MEDT]

  1. MODULE CursorExample; (* module shows you how to define an own cursor *)
  2.  
  3.       FROM CursorMouse IMPORT    Pattern, SetPattern, ResetPattern,
  4.                 GetMouse, ML, MM, MR;
  5.                           
  6.       VAR    OwnCursor    : Pattern;
  7.                Buttons    :BITSET;
  8.                i    : CARDINAL;
  9.                x,y    : INTEGER;
  10.        
  11. BEGIN
  12.       (* Define own cursor (a diagonal cross on white ground) *)
  13.       FOR i:=0 TO 15 DO
  14.             OwnCursor.raster[i]:={};
  15.             INCL(OwnCursor.raster[i],i);
  16.             INCL(OwnCursor.raster[i],15-i);
  17.             OwnCursor.mask[i]:={0..15};
  18.       END (* FOR *);
  19.       OwnCursor.hotSpv := 8;
  20.       OwnCursor.hotSph := 8;
  21.       SetPattern(OwnCursor);
  22.       LOOP
  23.             GetMouse(Buttons,x,y);
  24.             IF (MM IN Buttons) & (ML IN Buttons) THEN
  25.               (* Command key and mouse button pressed: leave the program *)
  26.               EXIT
  27.             ELSIF (MR IN Buttons) & (ML IN Buttons) THEN
  28.               (* Option key and mouse button pressed: reactivate own cursor *)
  29.               SetPattern(OwnCursor);
  30.             ELSIF (ML IN Buttons) THEN
  31.               (* Only mouse button pressed: reactivate standard arrow cursor *)
  32.               ResetPattern;
  33.             END (* IF *);
  34.       END (* LOOP *);
  35.       ResetPattern;
  36. END CursorExample.
  37.  
  38.